package com.cty.header;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("header")
@ResponseBody
public class HeaderController {
    /**
     * 获取请求头
     * 在形参前加上@RequestHeader(Value = 请求头中的哪项内容，直接写名字即可)
     *
     */

    @RequestMapping("data")
    public String data(@RequestHeader("Host") String Host) {
        System.out.println("header = " + Host);
        return "Host = " + Host;
    }
}
